import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [{
    path: '/login',
    component: resolve => require(['./views/Login'], resolve)
  }, {
    path: '/',
    component: resolve => require(['./views/Layout'], resolve),
    children: [{
      path: '',
      component: resolve => require(['./views/Dashboard'], resolve)
    }, {
      path: '/Admin/User/Index',
      component: resolve => require(['./views/Admin/User/Index'], resolve)
    }, {
      path: '/Admin/Role/Index',
      component: resolve => require(['./views/Admin/Role/Index'], resolve)
    }, {
      path: '/Admin/Rule/Index',
      component: resolve => require(['./views/Admin/Rule/Index'], resolve)
    }, {
      path: '/Admin/Activity/Index',
      component: resolve => require(['./views/Admin/Activity/Index'], resolve)
    }, {
      path: '/Admin/Activity/Add',
      component: resolve => require(['./views/Admin/Activity/Add'], resolve)
    }, {
      path: '/Admin/Form/Index',
      component: resolve => require(['./views/Admin/Form/Index'], resolve)
    }, {
      path: '/Admin/Form/Add',
      component: resolve => require(['./views/Admin/Form/Add'], resolve)
    }, {
      path: '/Admin/Seat/Index',
      component: resolve => require(['./views/Admin/Seat/Index'], resolve)
    }, {
      path: '/Admin/Seat/Add',
      component: resolve => require(['./views/Admin/Seat/Add'], resolve)
    }, {
      path: '/Admin/Seat/Edit',
      component: resolve => require(['./views/Admin/Seat/Edit'], resolve)
    }, {
      path: '*',
      component: resolve => require(['./views/Error'], resolve)
    }]
  }],
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return { x: 0, y: 0 }
    }
  }
})
